GTK_FLAGS = `pkg-config --cflags gtk+-3.0`
GTK_LIBS = `pkg-config --libs gtk+-3.0`
OBJECTS = $(patsubst src/%.c, build/%.o, $(wildcard src/*.c))

run: build
	./btc_ticker data/example.csv

clean:
	rm -f build/*.o btc_ticker

build: $(OBJECTS)
	gcc $(GTK_LIBS) build/*.o -o btc_ticker

build/builder.o: src/builder.c
	gcc -c $(GTK_FLAGS) src/builder.c -o build/builder.o

build/logic.o: src/logic.c src/widgets.h
	gcc -c $(GTK_FLAGS) src/logic.c -o build/logic.o
	
build/main.o: src/main.c src/builder.h src/logic.h src/update.h
	gcc -c $(GTK_FLAGS) src/main.c -o build/main.o

build/update.o:src/update.c src/main.h src/widgets.h src/get_crypto_price.h
	gcc -c $(GTK_FLAGS)  src/update.c -o build/update.o

build/get_crypto_price.o: src/get_crypto_price.c
	gcc -c src/get_crypto_price.c -o build/get_crypto_price.o

